<template>
	<view>
		<view>
			<view class="con">
				<u-row>
					<u-col :span="12" v-if="niudan==1">
						<view class="item" @click="toLuck()">
							<view class="up">
								<image class="pic1" src="../static/lick_img.png"></image>
								<view class="text">
									<view class="text1">蜂盈扭扭蛋</view>
									<view class="text2">{{date}}</view>
								</view>
							</view>
							<view class="down">
								<image src="/static/image/a6.png" mode=""></image>
							</view>
						</view>
					</u-col>
					<u-col :span="12" v-if="show2">
						<view class="item" @click="recieve">
							<view class="up">
								<image class="pic1" src="../static/lick_img3.png"></image>
								<view class="text">
									<view class="text1">新手领红包</view>
									<view class="text2">来蜂盈得红包</view>
								</view>

							</view>
							<view class="down">
								<image src="/static/image/a6.png" mode=""></image>
							</view>
						</view>
					</u-col>
					<u-col :span="12" v-if="first==1">
						<view class="item" @click="toGroup()">
							<view class="up">
								<image class="pic1" src="../static/lick_img2.png"></image>
								<view class="text">
									<view class="text1">亲友团财团版</view>
									<view class="text2">奇异果蜂巢主发起</view>
								</view>
							</view>
							<view class="down">
								<image src="/static/image/a6.png" mode=""></image>
							</view>
						</view>
					</u-col>
					<u-col :span="12" v-if="second==1">
						<view class="item" @click="toGroup2()">
							<view class="up">
								<image class="pic1" src="../static/lick_img4.png"></image>
								<view class="text">
									<view class="text1">亲友团富翁版</view>
									<view class="text2">葡萄蜂巢主发起</view>
								</view>
							</view>
							<view class="down">
								<image src="/static/image/a6.png" mode=""></image>
							</view>
						</view>
					</u-col>
					<u-col :span="12" v-if="third==1">
						<view class="item" @click="toGroup3()">
							<view class="up">
								<image class="pic1" src="../static/lick_img5.png"></image>
								<view class="text">
									<view class="text1">亲友团新手版</view>
									<view class="text2">蜂盈新手发起</view>
								</view>
							</view>
							<view class="down">
								<image src="/static/image/a6.png" mode=""></image>
							</view>
						</view>
					</u-col>
					<u-col :span="12" v-if="false">
						<view class="item" @click="toLuck2()">
							<view class="up">
								<image class="pic1" src="../static/lick_img6.png"></image>
								<view class="text">
									<view class="text1">推新大比拼</view>
									<view class="text2">推荐新人得丰厚奖励</view>
								</view>
							</view>
							<view class="down">
								<image src="/static/image/a6.png" mode=""></image>
							</view>
						</view>
					</u-col>
					<u-col :span="12" v-if="false">
						<view class="item ax" @click="toLuck3()">
							<view class="up">
								<image class="pic1" src="../static/lick_img4.png"></image>
								<view class="text">
									<view class="text1">新人见面礼</view>
									<view class="text2">完成新手任务，领取见面礼</view>
								</view>
							</view>
							<view class="down">
								<image src="/static/image/a6.png" mode=""></image>
							</view>
						</view>
					</u-col>
					<u-col :span="12" v-if="false">
						<view class="item ax1">
							<view class="up">
								<image class="pic1" src="../static/lick_img7.png"></image>
								<view class="text">
									<view class="text1">公测大礼包</view>
									<view class="text2">注册新用户领取8蜜贝奖励</view>
								</view>
							</view>
							<view class="down1">
								<image class="image1" v-if="staticx == 0" src="../static/lick_img8.png"
									style="margin-right: 0rpx;"></image>
								<image class="image2" v-if="staticx == 0" src="/static/image/a13.png" mode=""
									@click="down1_but"></image>
								<image class="image2" v-if="staticx == 1" src="/static/image/a14.png" mode=""></image>
							</view>
						</view>
					</u-col>
					<u-col :span="12" v-if="share_active==1">
						<view class="item ax2" @click="toLuck4()">
							<view class="up">
								<image class="pic1" src="../static/lick_img10.png"></image>
								<view class="text">
									<view class="text1">好友分享礼</view>
									<view class="text2">好友抢拍蜂巢，可获蜜贝好礼</view>
								</view>
							</view>
							<view class="down">
								<image src="/static/image/a6.png" mode=""></image>
							</view>
						</view>
					</u-col>
					<u-col :span="12" v-if="welfarehide==0">
						<view class="item ax3" @click="toLuck5()">
							<view class="up">
								<image class="pic1" src="../static/lick_img11.png"></image>
								<view class="text">
									<view class="text1">福利专区</view>
									<view class="text2">达成条件领取专属福利</view>
								</view>
							</view>
							<view class="down">
								<image src="/static/image/a6.png" mode=""></image>
							</view>
						</view>
					</u-col>
          <u-col :span="12">
            <view class="item ax4" @click="handleToGold">
              <view class="up">
                <image class="pic1" src="../static/bonus.png"></image>
                <view class="text">
                  <view class="text1">金蜜券大奖</view>
                  <view class="text2">做任务领金蜜券，彩蛋奖励等你拿</view>
                </view>
              </view>
              <view class="down">
                <image src="/static/image/a6.png" mode=""></image>
              </view>
            </view>
          </u-col>
				</u-row>
			</view>
		</view>
		<u-popup mode="center" v-model="show" background="transparent">
			<image src="../static/r0.png" @click="toPage('../red/index?recieve_time='+recieve_time)" class="red">
			</image>
		</u-popup>
		<!-- 	扭蛋中奖-->
		<u-popup v-model="show1" close-icon-pos="top-left" background="transparent" :closeable="true" borderRadius="10"
			mode="bottom">
			<view class="popup">
				<view class="live_box">
					<view class="title">恭喜您</view>
					<view class="img_box">
						<image src="../static/lick_img9.png"></image>

						<image class="img" src="../static/blind_bg5.png"></image>
					</view>
					<view class="title_text">获得了公测礼包</view>
					<view class="text">
						<text>8</text>
						<text class="text_color">蜜贝</text>
					</view>
					<view class="live_but">
						<view class="but" @click="close_but()">
							我知道了
						</view>
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	var than;
	export default {
		data() {
			return {
				show: false,
				show2: true,
				novice_reward_status: 0,
				recieve_time: 0,
				findStatus: true,
				date: "",
				second: 0,
				third: 0,
				first: 0,
				show1: false,
				staticx: 1,
				welfarehide:0,
				share_active: 0,
				niudan: 0
			}
		},
		onLoad(option) {
			than = this;
			than.novice_reward_status = option.novice_reward_status
			than.recieve_time = option.recieve_time
			than.post('api/gashapon/openTime', null, function(data) {
				if (than.checkDataNull(data)) {
					than.date = data.begin.replace(/-/g, '.') + "-" + data.end.replace(/-/g, '.')
				} else {
					than.date = "敬请期待"
				}
			})
			than.post('api/Groupwork/activeOnOff', null, function(data) {
				than.first = parseInt(data.first)
				than.second = parseInt(data.second)
				than.third = parseInt(data.third)
				than.share_active = parseInt(data.share_active)
				than.niudan = parseInt(data.niudan)
				than.welfarehide=parseInt(data.welfarehide)
			})
			if (than.novice_reward_status == 4) {
				than.show2 = false;
			}
			than.show2 = false;

			than.is_fun()

		},
		onReady: function(e) {

		},
		onReachBottom() {

		},
		methods: {
			is_fun() {
				than.post('api/center/switchNovice', null, function(data) {
					//console.log(data)
					than.staticx = data
				})

			},
			toGroup() {
				than.post('api/Groupwork/findStatus', null, function(data) {
					if (data) {
						than.toPage('../group/index')
					} else {
						than.toPage('../group/group')
					}
				})
			},
			toGroup2() {
				than.post('api/groupwork_small/findStatus', null, function(data) {
					if (data) {
						than.toPage('../group/index2')
					} else {
						than.toPage('../group/group2')
					}
				})
			},
			toGroup3() {
				than.post('api/Groupwork_novice/findStatus', null, function(data) {
					if (data) {
						than.toPage('../group/index3')
					} else {
						than.toPage('../group/group3')
					}
				})
			},
			recieve() {
				if (than.novice_reward_status == 1) {
					than.post('api/novice_reward/recieve', null, function(data) {
						than.recieve_time = data;
						than.show = true;
					})
				} else if (than.novice_reward_status == 2) {
					than.toPage('../red/index?recieve_time=' + than.recieve_time)
				} else {
					than.show2 = false;
				}
			},
			toLuck() {
				than.post('api/gashapon/activeStauts', null, function(data) {
					if (than.checkDataNull(data)) {
						than.toPage('../luck/index')
					} else {
						than.toast('暂未开放')
					}
				})
			},
      /** 跳转到金蜜券大奖
       */
      handleToGold() {
        than.toPage('/pages/htmlB/gold/index')
      },
			toLuck2() {
				than.toPage('../data/index')
			},
			toLuck3() {
				than.toPage('../blind/index')
				// than.post('api/Gashapon/manorSecondStatus', null, function(data) {
				// 	//console.log(data.swith_status)
				// 	if(data.swith_status == 1){
				// 		than.toPage('../blind/index')
				// 	}else if(data.swith_status == 0){
				// 		than.toast('您当前未抢拍过严选新生鲜以上的蜂巢暂不能进入')
				// 	}
				// })
			},
			toLuck4() {
				than.toPage('../share/index')
			},
			toLuck5() {
				than.toPage('../welfare/index')
			},
			down1_but() {
				than.post('api/center/giveNoviceKmbToUser', null, function(data) {
					than.show1 = true
					than.is_fun()
				})
			},
			close_but() {
				than.show1 = false
			},
		}
	}
</script>

<style lang="less">
	.red {
		width: 750rpx;
		height: 668rpx;
	}


	.top {
		padding: 0rpx 35rpx;
		height: 300rpx;
		z-index: 1;
		display: flex;

		.text {
			font-size: 60rpx;
			font-weight: bold;
			color: #333333;
			margin-top: 50rpx;
		}

		.m2 {
			margin-left: auto;
			width: 294rpx;
			height: 377rpx;
		}
	}

	.con {
		border-radius: 70rpx 0rpx 0rpx 0rpx;
		padding: 35rpx;

		.item:first-child {
			margin-top: 0rpx;
		}

		.ax {
			background: #FEF0EF !important;
		}

		.ax1 {
			background: #EBF0FB !important;
		}

		.ax2 {
			background: #F1F8FD !important;
		}

		.ax3 {
			background: #FBEBEB !important;
		}

    .ax4 {
      background: #F1FDF5 !important;
    }

		.item {
			background: #FFFFFF;
			border-radius: 20rpx;
			width: 618rpx;
			height: 332rpx;
			background: #FBF5EB;
			border-radius: 20rpx;
			padding: 0 25rpx;
			margin: 0 20rpx 30rpx;
			text-align: center;

			.up {
				display: flex;
				align-items: center;
				height: 180rpx;
			}

			.down {
				display: flex;
				align-items: center;
				height: 150rpx;

				image {
					width: 123rpx;
					height: 123rpx;
					margin-left: auto;
				}
			}

			.down1 {
				display: flex;
				align-items: center;
				height: 150rpx;
				justify-content: flex-end;

				.image1 {
					width: 55rpx;
					height: 47rpx;

				}

				.image2 {
					width: 123rpx;
					height: 123rpx;

				}
			}

			.pic1 {
				width: 144rpx;
				height: 144rpx;
				margin: 10rpx 0 20rpx;
			}

			.text {
				flex: 1;
				margin-left: 10rpx;
				text-align: left;
				margin-left: 26rpx;

				.text1 {
					font-size: 32rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #333333;
				}

				.text2 {
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #999999;
					margin-top: 20rpx;
				}
			}

			.pic2 {
				width: 45rpx;
				height: 45rpx;
			}
		}
	}

	.popup {
		.live_box {
			width: 750rpx;
			background-color: white;

			.title {
				font-size: 38rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #333333;
				text-shadow: 0px 5rpx 3rpx rgba(193, 133, 68, 0.12);
				height: 97rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				border-bottom: 1px solid #F6F6F6;
			}

			.img_box {
				position: relative;
				width: 100%;
				text-align: center;

				image {
					width: 426rpx;
					height: 391rpx;
				}

				.img {
					width: 110rpx;
					height: 110rpx;
					position: absolute;
					top: -70rpx;
					left: 0;
					right: 0;
					bottom: 0;
					margin: auto;
				}
			}

			.text {
				text-align: center;
				font-size: 60rpx;
				color: #FB683D;
				font-weight: bold;
				margin-top: 20rpx;

				.text_color {
					margin-top: -10rpx;
					color: #FB683D;
					font-size: 28rpx;
				}

				text {
					color: #FB683D;
					padding: 0rpx 10rpx;
				}
			}

			.title_text {
				text-align: center;
				font-size: 28rpx;
				font-weight: 500;
				color: #666666;
				margin-top: 10rpx;
			}

			.live_but {
				margin-top: 30rpx;
				padding-bottom: 60rpx;

				.but {
					line-height: 80rpx;
					text-align: center;
					font-size: 30rpx;
					font-weight: 500;
					color: #FFFFFF;
					margin: auto;
					width: 245rpx;
					height: 80rpx;
					background: #FB683D;
					border-radius: 20rpx;
				}
			}
		}

	}
</style>
